package com.shenzhenai.module_design_partterns.class1;

/**
 * @author huangzehui
 * @date 8/8/2025 上午12:25 周五
 * @description 设计模式-简单工厂
 * <p>
 * https://www.bilibili.com/video/BV1et3MzxEgJ/?spm_id_from=333.337.search-card.all.click&vd_source=e07cc8cc94eb22bd76722071b03cd199
 */
public class CashFactory {

    public static CashSuper createCashAdapter(String type) {
        return switch (type) {
            case "正常消费" -> new CashNormal();
            case "满300返100" -> new CashReturn(300,200);
            case "打8折" -> new CashRebate(0.80);
            default -> throw new IllegalArgumentException("Unexpected value: " + type);
        };
    }

}
